1. Field of the Invention
The invention relates to a color image processing system and more particularly to a method of reversibly converting a color image between a first color space and a second color space with minimal loss of image integrity.
2. Description of the Prior Art
In the prior art it is common to convert an image from one color space to another. These conversions are necessary because the red-green-blue (RGB) color space that is used to display images on a display device such as a cathode-ray-tube (CRT) is not readily compressible when digitally recorded. To efficiently store the information, a luminance-chrominance (YCrCb) color space has been developed which enables the digital representation of the image to be much more greatly compressed. International standards have been developed for converting the representation of these different color spaces from one form to another. The Comite Consultalif International des Radiocommunications (CCIR) has established the formulas in standard CCIR 601 for converting between the luminance-chrominance (YCrCb) color space and the red-green-blue (RGB) color space. The formulas for converting RGB to YCrCb are: EQU Y=0.299R+0.587G+0.114B EQU Cr=0.713 (R-Y)+128 EQU Cb=0.564 (B-Y)+128
The formulas for converting YCrCb to RGB are: EQU R=Y+1.402 (Cr-128) EQU G=Y-0.714 (Cr-128)-0.344 (Cb-128) EQU B=Y+1.772 (Cb-128)
Using floating point arithmetic the conversion from one color space to the other can be achieved without loss of integrity as the calculations can be made as required to ensure that the ultimate result of any particular conversion is not subject to a rounding error. Also, such a conversion requires that each color point in each color space be convertible to a color point in the other color space. In the situation where each point of the color space is represented by three elements, such as Red, Green and Blue, each element can have one of 256 values or, in other words, the color space can represent 256.times.256.times.256=16.7 million colors. The conversion of each point to a corresponding point in the other color space can be very time consuming and requires large amounts of storage space.
One way of overcoming the time delays and storage constraints in performing the floating point conversion has been the development of a set of look-up tables whereby a point in a first color space is directly converted to a point in the second color space by looking up the corresponding value in a look-up table. For this table look-up process to provide effective and speedy conversion it is essential that the number of values in the tables and the number of tables be reduced to the minimal number necessary to enable a human viewer of an image to obtain a reasonably valid perception of the image when displayed.
The table look-up process for converting from YCrCb to RGB works satisfactorily in those situations where the image is to be converted once and then discarded, for example, when an image is printed. However, when the image is to be kept and displayed or manipulated a plurality of times where it is necessary to convert the image back and forth between the two color spaces, the quality of the image can deteriorate substantially because of rounding errors in the conversion process. As these errors compound with each conversion the quality of the resulting image becomes less and less acceptable.
The image distortion is similar to the following problem with photocopying a sample of text many times. A clean original sample of text on a page may be photocopied and will produce an accurate copy of the page. If you then photocopy the copy, a copy is produced with some amount of distortion. As you continue to photocopy the resultant copies, the distortion of the original sample increases with each copy until the point where the text becomes illegible.
The present invention compensates for the rounding errors by providing a process for generating and tuning the color space conversion look-up tables to maintain the reproducability of each original color point. Application of the look-up tables for converting YCrCb data into RGB data stabilizes 99.07% of the RGB data after the first conversion. The remaining 0.93% of the RGB data stabilizes after four conversions, ie. distortion will not propagate. For converting RGB data into YCrCb data, 99.93% of the YCrCb data stabilizes after the first conversion. The remaining 0.07% of the YCrCb data stabilizes after 3 conversions, again preventing propagation of errors.
It is accordingly a primary object of the present invention to enable multiple conversions of an image between one color space and another with minimal distortion to the data representation of the image.
A particular object is to provide multiple conversions of an image stored in YCrCb color space to an RGB color space and back to YCrCb color space without propagating any distortion to the data representation of the image.
It is a further object to tune look-up tables for conversion of images between RGB and YCrCb color spaces so that the image information is substantially stable over an infinite number of conversions.
It is a further object to apply the look-up tables in a computer program for converting image data within a micro-processor based system.